package com.itheima.mapper;

import com.itheima.pojo.Clazz;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.GetMapping;

import java.time.LocalDate;
import java.util.List;

/**
 * @Description:
 * @Author: Hank
 * @Date: 2025/3/4 15:18
 */

@Mapper
public interface ClazzMapper {

    @Select("select * from class where id = #{id} ")
    Clazz getInfo(Integer id);

    List<Clazz> list(String name, LocalDate begin, LocalDate end);


    @Select("delete from clazz where id = #{id}")
    void deleteById(Integer id);

    @Insert("insert into clazz values(null,#{name},#{room},#{beginDate},#{endDate},#{masterId}, #{subject},#{createTime},#{updateTime})")
    void addByClazz(Clazz clazz);

    void update(Clazz clazz);

    @Select("select * from clazz")
    List<Clazz> findAll();
}
